<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt"%>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	String applicationPath = basePath + "/" + "application";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet"
			type="text/css" />
		<script language="javascript" src="<%=path%>/js/util.js"></script>
		<script type='text/javascript'
			src='<%=path%>/frame/orgSelect/js/ajaxInitSelect.js'></script>
		<script language="javascript" src="<%=path%>/js/SyncCommon.js"></script>
	</head>
	<body>
		<html:form styleId="transitionForm"
			action="addTransition.do?method=addTransition"
			onsubmit="return save();">
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="margtb5">
				<tr>
					<td align="left" class="padl5 lan12">
						<img src="<%=path%>/images/img-11.gif" width="12" height="12">
						项目管理 &gt; 产品化管理 &gt; 查看
					</td>
				</tr>
			</table>

			<table cellspacing="1" cellpadding="0" width="98%" align="center"
				border="0" class="bgcolor2 margb5">

				<tr class="bgcolor">

					<td width="18%" align="right" class="zi13">
						<bean:message
							key="com.application.transition.entity.transition.createpage.projectName"
							bundle="transitionKey" />
						：
					</td>
					<td width="32%" align="left" class="pad2 zi13">
						${transition.projectname}

					</td>
					<td width="18%" align="right" class="zi13">
						<bean:message
							key="com.application.transition.entity.transition.createpage.projectNo"
							bundle="transitionKey" />
						：
					</td>
					<td width="32%" align="left" class="pad2 zi13">
						${transition.projectNo}
					</td>
				</tr>
				<tr class="bgcolor">
					<td width="18%" align="right" class="zi13">
						<bean:message
							key="com.application.transition.entity.transition.createpage.projectOrg"
							bundle="transitionKey" />
						：
					</td>
					<td width="32%" align="left" class="pad2 zi13">
						${transition.orgname}
					</td>
					<td width="18%" align="right" class="zi13">
						项目经理 ：
					</td>
					<td width="32%" align="left" class="pad2 zi13">
						${transition.uname}
					</td>
				</tr>
				<tr class="bgcolor">
					<td width="18%" align="right" class="zi13">
						发起年份 ：
					</td>
					<td width="32%" align="left" class="pad2 zi13" >
						${transition.initiateyear}
					</td>
										<td width="18%" align="right" class="zi13">
						资料总数 ：
					</td>
					<td width="32%" align="left" class="pad2 zi13">
						${transition.filenum}
					</td>
				</tr>
			</table>

			<br>
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margb5">
				<tr>
					<td colspan="4" class="bkuang bgcolor2 zi13b padl5">
						硬件原理图
					</td>

				</tr>
				<tr>
					<td align="center" width="30%" class="bgcolor3 brkuang zi13b">
						附件名称
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传人
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传时间
					</td>
					<td align="center" width="30%" class="bgcolor3 bkuang zi13b">
						操作
					</td>
				</tr>
				<logic:iterate name="yjylt" id="attachment">
					<tr>
						<td align="center" class="brkuang zi13">
							${attachment.filename}
						</td>
						<td align="center" class="brkuang zi13">
							${attachment.rname}
						</td>
						<td align="center" class="brkuang zi13">
							<bean:write name="attachment" property="inputtime"
								format="yyyy-MM-dd" />
						</td>
					
							<td align="center" class="bkuang padl5 zi13">
							<c:if test="${delQx=='Del'}">		<a href="#"
									onclick="delAttachment('${attachment.id}','${attachment.fid}','${attachment.type}','${attachment.operateid}')">删除</a>&nbsp;&nbsp;&nbsp;
							
						</c:if>
						<c:if test="${xzQx=='Xz'}">		
						<a href="#" onclick="download('${attachment.id}')">下载</a>
						</c:if>
						</td>
					</tr>
				</logic:iterate>
			</table>


			<br>
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margb5">
				<tr>
					<td colspan="4" class="bkuang bgcolor2 zi13b padl5">
						硬件PCB
					</td>

				</tr>
				<tr>
					<td align="center" width="30%" class="bgcolor3 brkuang zi13b">
						附件名称
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传人
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传时间
					</td>
					<td align="center" width="30%" class="bgcolor3 bkuang zi13b">
						操作
					</td>
				</tr>
				<logic:iterate name="yjpcb" id="attachment">
					<tr>
						<td align="center" class="brkuang zi13">
							${attachment.filename}
						</td>
						<td align="center" class="brkuang zi13">
							${attachment.rname}
						</td>
						<td align="center" class="brkuang zi13">
							<bean:write name="attachment" property="inputtime"
								format="yyyy-MM-dd" />
						</td>
						<td align="center" class="bkuang padl5 zi13">
							 <c:if test="${delQx=='Del'}">
							 <a href="#"
								onclick="delAttachment('${attachment.id}','${attachment.fid}','${attachment.type}','${attachment.operateid}')">删除</a>
							&nbsp;&nbsp;&nbsp;
							</c:if>
							<c:if test="${xzQx=='Xz'}">	
							<a href="#" onclick="download('${attachment.id}')">下载</a>
							</c:if>
						</td>
					</tr>
				</logic:iterate>
			</table>


			<br>
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margb5">
				<tr>
					<td colspan="4" class="bkuang bgcolor2 zi13b padl5">
						BOM清单
					</td>

				</tr>
				<tr>
					<td align="center" width="30%" class="bgcolor3 brkuang zi13b">
						附件名称
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传人
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传时间
					</td>
					<td align="center" width="30%" class="bgcolor3 bkuang zi13b">
						操作
					</td>
				</tr>
				<logic:iterate name="bom" id="attachment">
					<tr>
						<td align="center" class="brkuang zi13">
							${attachment.filename}
						</td>
						<td align="center" class="brkuang zi13">
							${attachment.rname}
						</td>
						<td align="center" class="brkuang zi13">
							<bean:write name="attachment" property="inputtime"
								format="yyyy-MM-dd" />
						</td>
						<td align="center" class="bkuang padl5 zi13">
						<c:if test="${delQx=='Del'}">
							<a href="#"
								onclick="delAttachment('${attachment.id}','${attachment.fid}','${attachment.type}','${attachment.operateid}')">删除</a>&nbsp;&nbsp;&nbsp;
							</c:if>
							<c:if test="${xzQx=='Xz'}">	
							<a href="#" onclick="download('${attachment.id}')">下载</a>
							</c:if>
						</td>
					</tr>
				</logic:iterate>
			</table>

			<br>
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margb5">
				<tr>
					<td colspan="4" class="bkuang bgcolor2 zi13b padl5">
						软件包
					</td>

				</tr>
				<tr>
					<td align="center" width="30%" class="bgcolor3 brkuang zi13b">
						附件名称
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传人
					</td>
					<td align="center" width="20%" class="bgcolor3 brkuang zi13b">
						上传时间
					</td>
					<td align="center" width="30%" class="bgcolor3 bkuang zi13b">
						操作
					</td>
				</tr>
				<logic:iterate name="rjb" id="attachment">
					<tr>
						<td align="center" class="brkuang zi13">
							${attachment.filename}
						</td>
						<td align="center" class="brkuang zi13">
							${attachment.rname}
						</td>
						<td align="center" class="brkuang zi13">
							<bean:write name="attachment" property="inputtime"
								format="yyyy-MM-dd" />
						</td>
						<td align="center" class="bkuang padl5 zi13">
						<c:if test="${delQx=='Del'}">
							<a href="#"
								onclick="delAttachment('${attachment.id}','${attachment.fid}','${attachment.type}','${attachment.operateid}')">删除</a>&nbsp;&nbsp;&nbsp;
						</c:if>
						<c:if test="${xzQx=='Xz'}">	
							<a href="#" onclick="download('${attachment.id}')">下载</a>
							</c:if>
						</td>
					</tr>
				</logic:iterate>
			</table>
		</html:form>
		<p>
		<p>
		<p>
			<html:form styleId="attachmentForm"
				action="/uploadAttachment.do?method=uploadAttachment" method="post"
				enctype="multipart/form-data">
				<table cellspacing="0" cellpadding="0" width="98%" align="center"
					border="0" class="kuang2 margb5">
					<tr>
						<td colspan="4" align="left" class="bkuang zi13b bgcolor2 padl5">
							添加附件
						</td>
					</tr>
					<tr>
						<td width="30%" align="right" class="brkuang zi13">
							资料类型：
							<font color="red">*&nbsp;</font>
						</td>
						<td width="70%" align="left" class="bkuang pad2 zi13">
							<select id='type' name="type">
								<option value="" selected>
									----请选择----
								</option>
								<option value="30002">
									硬件原理图
								</option>
								<option value="30003">
									硬件PCB
								</option>
								<option value="30005">
									BOM清单
								</option>
								<option value="30006">
									软件包
								</option>
							</select>
						</td>
					</tr>
					<tr>
						<td width="30%" align="right" class="brkuang zi13">
							备注：
							<font color="red">*&nbsp;</font>
						</td>
						<td width="70%" align="left" class="bkuang pad2 zi13">
							<textarea rows="3" cols="50" id="bak3" name="bak3" flag="true"
								valid="required|limitLength" max="100"
								errMsg="请输入备注信息|备注输入长度不能超过100个汉字"></textarea>
						</td>
					</tr>
					<tr>
						<td width="30%" align="right" class="brkuang zi13">
							附件：
						</td>
						<td width="70%" align="left" class="bkuang pad2 zi13">
							<html:file property="formFile" size="30"></html:file>
							<input type="button" onclick="upload();" name="Submit" value="上传"
								class="buttonbg"/>
						</td>
					</tr>
					<tr>
						<td align="right" class="rkuang zi13">
							上传要求：
						</td>
						<td align="left" class="padl5 zi13">
							允许上传多个附件（单个附件大小不能超过10MB）。
						</td>
					</tr>
				</table>
				<input type="hidden" name="bak1" id="bak1" />
				<input type="hidden" name="fid" id="fid" value="${transition.id}" />

				<p>
				<p>
				<p>
				<table width="98%" align="center" border="0" cellspacing="0"
					cellpadding="0">
					<tr>
						<td align="center">
							<input class="buttonbg" id="but_return" style="cursor: hand"
								type="button"
								value="<bean:message key='com.manager.common.yfplacefile.return' bundle="yfplacefile"/>"
								name="but_return" onClick="javascript:history.go(-1);" />
						</td>
					</tr>
				</table>


			</html:form>
	</body>
</html>


<script>

function upload(){
 
  var syncHelper = new SyncHelper();
 var type = syncHelper.selectedValue("type");
  if(type==null || type==""){
          alert("请选择资料类型！");
          return false;
   }
  if(validateForm(document.forms[1],'Y'))
  {
   
	  var projectNo = '${transition.projectNo}';
	  $('bak1').value = projectNo;
	  document.forms['attachmentForm'].action="placeFileUpload.do?method=placeFileUpload&lx=cph";
	  document.forms['attachmentForm'].submit();
  }


}


function download(id){
    window.location.href = "downPlaceFile.do?method=downCPH&id=" + id;
}

function delAttachment(id,fid,type,operateid){
    var curid = '${loginUser.id}';
    var bussName = "${transition.id}";
    if(curid != operateid){
       alert("只有删除自己上传的附件！");
       return false;
    }
    window.location.href = "deletePlaceFile.do?method=deleteCph&id=" + id + "&fid=" + fid + "&type=" + type + "&bussName=" + bussName;
}
</script>





